// InitProjectDlg.cpp : implementation file
//

#include "stdafx.h"
#include "resourcemake.h"
#include "resourcemakedlg.h"
#include "InitProjectDlg.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// CInitProjectDlg dialog


CInitProjectDlg::CInitProjectDlg(CWnd* pParent /*=NULL*/)
	: CDialog(CInitProjectDlg::IDD, pParent)
{
	//{{AFX_DATA_INIT(CInitProjectDlg)
		// NOTE: the ClassWizard will add member initialization here
	//}}AFX_DATA_INIT
}


void CInitProjectDlg::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CInitProjectDlg)
		// NOTE: the ClassWizard will add DDX and DDV calls here
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(CInitProjectDlg, CDialog)
	//{{AFX_MSG_MAP(CInitProjectDlg)
	ON_BN_CLICKED(IDC_INITPRO_NEXT, OnInitproNext)
	ON_BN_CLICKED(IDC_INITPRO_CANCEL, OnInitproCancel)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CInitProjectDlg message handlers

void CInitProjectDlg::OnInitproNext() 
{
	// TODO: Add your control notification handler code here
	     CString c1;
		 CString c2;
		 CString c3;
         this->GetDlgItemText(IDC_INITPRO_EDIT,c1);
         c2=c1+".ssml";
		 c3=c1+".ts";
		 ((CResourcemakeDlg *)AfxGetApp()->m_pMainWnd)->initprojectfile(c1);
		((CResourcemakeDlg *)AfxGetApp()->m_pMainWnd)->m_strVideoNameList.push_back(c1);
		((CResourcemakeDlg *)AfxGetApp()->m_pMainWnd)->m_strSSMLNameList.push_back(c2);
         ((CResourcemakeDlg *)AfxGetApp()->m_pMainWnd)->m_nPrjNum++;
	    // WritePrivateProfileString("ProjectList", c1+".pro", c1, ((CResourcemakeDlg *)AfxGetApp()->m_pMainWnd)->strtemp2);
	    // WritePrivateProfileString("ProjectList", c2, "syn.ssml", ((CResourcemakeDlg *)AfxGetApp()->m_pMainWnd)->strtemp2);
	if(((CResourcemakeDlg *)AfxGetApp()->m_pMainWnd)->m_nSsmlFile != "")
	{
		CString c4=((CResourcemakeDlg *)AfxGetApp()->m_pMainWnd)->m_nSsmlFile;
		((CResourcemakeDlg *)AfxGetApp()->m_pMainWnd)->m_ddd->reDrawAll(NULL);
        ((CResourcemakeDlg *)AfxGetApp()->m_pMainWnd)->m_dcb->delAllScene();
		((CResourcemakeDlg *)AfxGetApp()->m_pMainWnd)->m_dcb->saveSSMLToFile(((CResourcemakeDlg *)AfxGetApp()->m_pMainWnd)->m_nSsmlFile);
		((CResourcemakeDlg *)AfxGetApp()->m_pMainWnd)->m_IsSaveSsml = TRUE;

	}
    	 ((CResourcemakeDlg *)AfxGetApp()->m_pMainWnd)->projectname.push_back(c1);
	     OnCancel();//CDialog:
		 CInitProjectFinish m_initprojectfinish;
	     m_initprojectfinish.DoModal();
	

}

void CInitProjectDlg::OnInitproCancel() 
{
	// TODO: Add your control notification handler code here
	OnCancel();//CDialog:
}
